<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: "App",
  components: {},
  created() {
    //在页面加载时读取sessionStorage里的状态信息
    if (sessionStorage.getItem("store")) {
      this.$store.replaceState(
          Object.assign(
              {},
              this.$store.state,
              JSON.parse(sessionStorage.getItem("store"))
          )
      );
    }

    // 聊天

    //在页面刷新时将vuex里的信息保存到sessionStorage里
    window.addEventListener("beforeunload", () => {
      sessionStorage.setItem("store", JSON.stringify(this.$store.state));
    });
  }
};
</script>

<style>
body {
  margin: 0;
  padding: 0;
  height: 100vh;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  height: 100vh;

  /*!*灰色*!*/
  /*!* 滤镜效果 *!*/
  //filter: grayscale(100%);
  /*!* webkit内核 *!*/
  //-webkit-filter: grayscale(100%);
  /*!* 火狐内核 *!*/
  //-moz-filter: grayscale(100%);
  /*!* 微软内核 *!*/
  //-ms-filter: grayscale(100%);
  /*!* 欧朋内核 *!*/
  //-o-filter: grayscale(100%);
  /*!* ie专有滤镜 *!*/
  //filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
}
</style>
